import { Controller, Post, Body, Param, Delete } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { Result } from 'src/common/Result';
import { CreateTabItemDto } from './createTabItem.dto';
import { TabService } from './tab.service';

@ApiTags('Tab')
@Controller('tab')
export class TabController {
  constructor(private readonly tabService: TabService) {}

  @Post(':collectionId')
  async create(
    @Body() tab: CreateTabItemDto,
    @Param('collectionId') cid: string,
  ): Promise<Result> {
    await this.tabService.create(cid, tab);
    return {
      message: '操作成功',
    };
  }

  @Delete(':id')
  async remove(
    @Body() TabCollectionId: string,
    @Param('id') id: string,
  ): Promise<Result> {
    await this.tabService.remove(id);
    return {
      message: '操作成功',
    };
  }
}
